package com.demo.understandmvc.控制器增强.requestBodyAdvice;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.demo.understandmvc.返回值处理.responseEntity.MyData;

@RestController
public class BodyAdviceController {

	@PostMapping("/bodyAdvice")
	public String bodyAdvice(@RequestBody MyData mydata) {
		System.out.println(mydata);
		return mydata.toString();
	}

	@GetMapping("/bodyAdvice2")
	@ResponseBody
	public MyData bodyAdvice2() {
		MyData data = new MyData();
		data.setFirstName("aa");
		data.setLastName("bb");
		return data;
	}

}
